import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;

public class ESTestClient {

    /**
     * 方法说明: 尝试获取ES连接
     * @param args
     * @return void
     * @author liangalong[liangalong2022@aliyun.com]
     * @date 2023-03-05 18:48*/
    public static void main(String[] args) throws Exception  {
        //创建es客户端
        RestHighLevelClient esClient = new RestHighLevelClient(RestClient.builder(new HttpHost("127.0.0.1", 9200)));
        System.err.println(esClient);

        //关闭客户端连接
        esClient.close();
    }
}
